﻿using Newtonsoft.Json;

namespace AutomationCommand
{
    public class autoitX : BasiCommand
    {
        [JsonProperty("op")]
        public string Operation { get; set; }

        [JsonProperty("parameter")]
        public ParameterOption Parameter { get; set; }

        public autoitX()
        {
            FunctionType = "autoitX";
            OtherName = "控件操作";
            Operation = "";
            Parameter = new ParameterOption
            {
                Dtsourc = "",
                Title = "",
                Id = "",
                Text = "",
                X = "0",
                Y = "0",
                Delay = ""
            };
            SuccessJump = -1;
            FailureJump = -1;
        }

        public bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }

        public class ParameterOption
        {
            [JsonProperty("dtsourc")]
            public string Dtsourc { get; set; }

            [JsonProperty("title")]
            public string Title { get; set; }

            [JsonProperty("id")]
            public string Id { get; set; }

            [JsonProperty("text")]
            public string Text { get; set; }

            [JsonProperty("x")]
            public string X { get; set; }

            [JsonProperty("y")]
            public string Y { get; set; }

            [JsonProperty("delay")]
            public string Delay { get; set; }
        }
    }
}
